package org.eclipselabs.egf.portfolio.task.scala.test.bigdecimal

import org.eclipse.core.runtime.IProgressMonitor
import org.eclipse.egf.core.EGFCorePlugin
import org.eclipse.egf.core.producer.InvocationException
import org.eclipse.egf.ftask.producer.context.ITaskProductionContext
import org.eclipse.egf.ftask.producer.invocation.ITaskProduction
import java.math.BigDecimal

class BigDecimalEquals extends ITaskProduction{
	var a1 = new BigDecimal("1.8")
	var b1 = new BigDecimal("10.3")
	var c1 = new BigDecimal("13.2")
	var d1 = new BigDecimal("23.5")
	var e1 = new BigDecimal("36.7")
	var f1 = new BigDecimal("310.20")
	
	def preExecute(taskProductionContext:ITaskProductionContext , monitor:IProgressMonitor ) ={
	}
	
	def doExecute(taskProductionContext:ITaskProductionContext , monitor:IProgressMonitor )={
		var a = taskProductionContext.getInputValue("inA", classOf[BigDecimal])
		var b = taskProductionContext.getInputValue("inB", classOf[BigDecimal])
		var c = taskProductionContext.getInputValue("inC", classOf[BigDecimal])
		var d = taskProductionContext.getInputValue("inD", classOf[BigDecimal])
		var e = taskProductionContext.getInputValue("inE", classOf[BigDecimal])
		var f = taskProductionContext.getInputValue("inF", classOf[BigDecimal])
		if(a.compareTo(a1) == 0 && b.compareTo(b1) == 0
				&& c.compareTo(c1) == 0 && d.compareTo(d1) == 0
				&& e.compareTo(e1) == 0 && f.compareTo(f1) == 0)
			EGFCorePlugin.getDefault().logWarning("Test Passed")
		else
			EGFCorePlugin.getDefault().logError("Test Failed")
	}
	
	def postExecute(taskProductionContext:ITaskProductionContext , monitor:IProgressMonitor )={
	}
}